package com.test.adapter;

import com.test.config.SetConfig;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;

public class SetAdapter extends BaseAdapter {

	private Context mContext = null;
	
	public SetAdapter(Context context){
		mContext = context;		
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return SetConfig.SET_LIST.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		TextView textView;
		if (convertView == null)
		{
			// 给ImageView设置资源
			textView = new TextView(mContext);
			// 设置布局 图片120×120显示
			ListView.LayoutParams params = new ListView.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
			textView.setLayoutParams(params);
		}else{
			textView = (TextView) convertView;
		}
		textView.setText(SetConfig.SET_LIST[position]);
		
		return textView;
	}

}
